from typing import Annotated
from fastapi import APIRouter, Depends, status
from app.api.deps import CurrentUser, SessionDep
from app import services
from app import models

router = APIRouter()

@router.post("/match-predict/europe-168", response_model=models.MatchPredictEurope168ResultResponse)
async def get_match_predict_europe_168(
    session: SessionDep, 
    current_user: CurrentUser, 
    req: models.MatchPredictEurope168Condition
):
    """
    根据条件查询欧洲赔率预测数据
    支持按赛事名称、球队名称、时间范围、赔率极范围、概率范围等条件筛选
    """
    return await services.MatchPredictService(current_user=current_user, db=session).get_match_predict_europe_168(req)


@router.post("/match-predict/historical-similar", response_model=models.HistoricalSimilarResponse)
async def get_historical_similar_stats(
    session: SessionDep,
    current_user: CurrentUser,
    req: models.HistoricalSimilarCondition
):
    """
    获取历史同概统计信息
    根据概率范围查询匹配的比赛统计信息，返回胜平负统计和胜率
    """
    return await services.HistoricalSimilarService(current_user=current_user, db=session).get_historical_similar_stats(req)


@router.post("/match-predict/cold-play-analysis", response_model=models.ColdPlayAnalysisResponse)
async def get_cold_play_analysis_stats(
    session: SessionDep,
    current_user: CurrentUser,
    req: models.ColdPlayAnalysisCondition
):
    """
    获取爆冷分析统计信息
    根据条件查询匹配的比赛统计信息，返回爆冷场次和爆冷率
    """
    return await services.ColdPlayAnalysisService(current_user=current_user, db=session).get_cold_play_analysis_stats(req)


@router.post("/match-predict/historical-same-odds", response_model=models.HistoricalSameOddsResponse)
async def get_historical_same_odds(
    session: SessionDep,
    current_user: CurrentUser,
    req: models.HistoricalSameOddsCondition
):
    """
    获取历史同赔数据
    根据条件查询 t_match_europe_168 表中符合条件的历史同赔记录
    支持按赛事名称、球队、赔率等多维度条件筛选
    """
    return await services.HistoricalSameOddsService(current_user=current_user, db=session).get_historical_same_odds(req)


# @router.post("/match-predict/same-odds-168-analysis", response_model=models.SameOdds168AnalysisResponse)
# async def get_same_odds_168_analysis(
#     session: SessionDep,
#     current_user: CurrentUser,
#     req: models.SameOdds168AnalysisCondition
# ):
#     """
#     获取同赔168分析统计信息
#     根据赔率范围查询 t_match_europe_168 表中符合条件的比赛统计信息
#     返回胜平负统计和最常见比分
#     """
#     return await services.SameOdds168AnalysisService(current_user=current_user, db=session).get_same_odds_168_analysis(req)
